wayland: Fall back to an unthemed default cursor
authorMatthias Clasen <mclasen@redhat.com>
Sun, 26 Apr 2020 18:42:45 +0000 (14:42 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 26 Apr 2020 18:42:45 +0000 (14:42 -0400)
In the absence of icon themes (such as in a freshly
created toolbox container), we should not just fall back
to "no cursor", since that makes it hard even to close
the application. Fall back to an included default cursor
of last resort.

gdk/wayland/gdkcursor-wayland.c

index f880b9da2dc999838912ed83d6e657a954f3a88c..66a461dd6c540a6f6169d42c658a2873b7f5c012 100644 (file)
@@ -162,6 +162,8 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
                                 int               *height,
                                 int               *scale)
 {
+  GdkTexture *texture;
+
   if (gdk_cursor_get_name (cursor))
     {
       struct wl_cursor *c;
@@ -199,10 +201,12 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
     }
   else
     {
-      GdkTexture *texture = gdk_cursor_get_texture (cursor);
       cairo_surface_t *surface;
       struct wl_buffer *buffer;
 
+      texture = gdk_cursor_get_texture (cursor);
+
+from_texture:
       surface = g_hash_table_lookup (display->cursor_surface_cache, cursor);
       if (surface == NULL)
         {
@@ -241,6 +245,11 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
                                            hotspot_x, hotspot_y,
                                            width, height,
                                            scale);
+  else
+    {
+      texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
+      goto from_texture;
+    }
 
 none:
   *hotspot_x = 0;